using Microsoft.Win32;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace TVSGPP.tools
{
	public class frmAppOption : Form
	{
		private IContainer components = null;
		private SplitContainer splitContainer1;
		private TreeView trvOption;
		private Button btnClose;
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
			TreeNode treeNode = new TreeNode("Giao diện chính");
			TreeNode treeNode2 = new TreeNode("Chức năng cụ thể");
			TreeNode treeNode3 = new TreeNode("Giao diện làm việc", new TreeNode[]
			{
				treeNode,
				treeNode2
			});
			TreeNode treeNode4 = new TreeNode("Nhập hàng");
			TreeNode treeNode5 = new TreeNode("Bán lẻ");
			TreeNode treeNode6 = new TreeNode("Nhập xuất", new TreeNode[]
			{
				treeNode4,
				treeNode5
			});
			TreeNode treeNode7 = new TreeNode("Độ chính xác sau dấu phẩy");
			TreeNode treeNode8 = new TreeNode("Định dạng", new TreeNode[]
			{
				treeNode7
			});
			TreeNode treeNode9 = new TreeNode("Sổ theo dõi nhiệt độ - độ ẩm");
			TreeNode treeNode10 = new TreeNode("Sổ theo dõi", new TreeNode[]
			{
				treeNode9
			});
			TreeNode treeNode11 = new TreeNode("Tuỳ chọn");
			TreeNode treeNode12 = new TreeNode("Kê đơn thuốc", new TreeNode[]
			{
				treeNode11
			});
			this.splitContainer1 = new SplitContainer();
			this.trvOption = new TreeView();
			this.btnClose = new Button();
			this.splitContainer1.Panel1.SuspendLayout();
			this.splitContainer1.SuspendLayout();
			base.SuspendLayout();
			this.splitContainer1.Cursor = Cursors.Hand;
			this.splitContainer1.IsSplitterFixed = true;
			this.splitContainer1.Location = new Point(0, 0);
			this.splitContainer1.Name = "splitContainer1";
			this.splitContainer1.Panel1.Controls.Add(this.trvOption);
			this.splitContainer1.Panel1MinSize = 250;
			this.splitContainer1.Panel2.BackColor = Color.White;
			this.splitContainer1.Size = new Size(634, 418);
			this.splitContainer1.SplitterDistance = 250;
			this.splitContainer1.TabIndex = 0;
			this.trvOption.Dock = DockStyle.Fill;
			this.trvOption.Location = new Point(0, 0);
			this.trvOption.Name = "trvOption";
			treeNode.Name = "Node1";
			treeNode.Text = "Giao diện chính";
			treeNode2.Name = "Node2";
			treeNode2.Text = "Chức năng cụ thể";
			treeNode3.Name = "Node0";
			treeNode3.Text = "Giao diện làm việc";
			treeNode4.Name = "Node4";
			treeNode4.Text = "Nhập hàng";
			treeNode5.Name = "Node5";
			treeNode5.Text = "Bán lẻ";
			treeNode6.Name = "Node3";
			treeNode6.Text = "Nhập xuất";
			treeNode7.Name = "Node7";
			treeNode7.Text = "Độ chính xác sau dấu phẩy";
			treeNode8.Name = "Node6";
			treeNode8.Text = "Định dạng";
			treeNode9.Name = "Node9";
			treeNode9.Text = "Sổ theo dõi nhiệt độ - độ ẩm";
			treeNode10.Name = "Node8";
			treeNode10.Text = "Sổ theo dõi";
			treeNode11.Name = "Node11";
			treeNode11.Text = "Tuỳ chọn";
			treeNode12.Name = "Node10";
			treeNode12.Text = "Kê đơn thuốc";
			this.trvOption.Nodes.AddRange(new TreeNode[]
			{
				treeNode3,
				treeNode6,
				treeNode8,
				treeNode10,
				treeNode12
			});
			this.trvOption.Size = new Size(250, 418);
			this.trvOption.TabIndex = 1;
			this.trvOption.AfterSelect += new TreeViewEventHandler(this.trvOption_AfterSelect);
			this.btnClose.Cursor = Cursors.Hand;
			this.btnClose.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnClose.Location = new Point(535, 427);
			this.btnClose.Name = "btnClose";
			this.btnClose.Size = new Size(90, 30);
			this.btnClose.TabIndex = 2;
			this.btnClose.Text = "Thoát [ ESC ]";
			this.btnClose.UseVisualStyleBackColor = true;
			this.btnClose.Click += new EventHandler(this.btnClose_Click);
			base.AutoScaleDimensions = new SizeF(7f, 15f);
			//base.AutoScaleMode = AutoScaleMode.Font;
			base.ClientSize = new Size(634, 466);
			base.Controls.Add(this.btnClose);
			base.Controls.Add(this.splitContainer1);
			this.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			//base.Icon = (Icon)componentResourceManager.GetObject("$this.Icon");
			base.KeyPreview = true;
			this.MaximumSize = new Size(650, 500);
			this.MinimumSize = new Size(650, 500);
			base.Name = "frmAppOption";
			base.ShowInTaskbar = false;
			base.StartPosition = FormStartPosition.CenterScreen;
			this.Text = "..: Tuỳ biến chương trình";
			base.Load += new EventHandler(this.frmAppOption_Load);
			base.KeyDown += new KeyEventHandler(this.frmAppOption_KeyDown);
			this.splitContainer1.Panel1.ResumeLayout(false);
			this.splitContainer1.ResumeLayout(false);
			base.ResumeLayout(false);
		}
		public frmAppOption()
		{
			this.InitializeComponent();
		}
		private void frmAppOption_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyData == Keys.Escape)
			{
				base.Close();
			}
		}
		private void frmAppOption_Load(object sender, EventArgs e)
		{
			try
			{
				RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software\\TVSGPP", true);
				if (registryKey == null)
				{
					RegistryKey registryKey2 = Registry.CurrentUser.OpenSubKey("Software", true);
					registryKey2.CreateSubKey("TVSGPP");
					registryKey2.Close();
				}
				registryKey.Close();
			}
			catch
			{
			}
			this.trvOption.ExpandAll();
			this.clearControl(this.splitContainer1, "objF1");
			frmAppOptionMain frmAppOptionMain = new frmAppOptionMain();
			frmAppOptionMain.grB1.Enabled = true;
			frmAppOptionMain.TopLevel = false;
			frmAppOptionMain.Dock = DockStyle.Fill;
			this.splitContainer1.Panel2.Controls.Add(frmAppOptionMain);
			frmAppOptionMain.Show();
		}
		private void btnClose_Click(object sender, EventArgs e)
		{
			base.Close();
		}
		private void clearControl(SplitContainer ctl, string objName)
		{
			for (int i = 0; i < ctl.Panel2.Controls.Count; i++)
			{
				if (ctl.Panel2.Controls[i].Name.ToString().ToUpper() != objName.ToUpper())
				{
					ctl.Panel2.Controls.RemoveAt(i);
					break;
				}
			}
		}
		private void trvOption_AfterSelect(object sender, TreeViewEventArgs e)
		{
			string name = this.trvOption.SelectedNode.Name;
			string text = name;
			switch (text)
			{
			case "Node0":
				this.clearControl(this.splitContainer1, "objF1");
				return;
			case "Node1":
			{
				this.clearControl(this.splitContainer1, "objF1");
				frmAppOptionMain frmAppOptionMain = new frmAppOptionMain();
				frmAppOptionMain.grB1.Enabled = true;
				frmAppOptionMain.TopLevel = false;
				frmAppOptionMain.Dock = DockStyle.Fill;
				this.splitContainer1.Panel2.Controls.Add(frmAppOptionMain);
				frmAppOptionMain.Show();
				return;
			}
			case "Node2":
			{
				this.clearControl(this.splitContainer1, "objF1");
				frmAppOptionMain frmAppOptionMain = new frmAppOptionMain();
				frmAppOptionMain.grB2.Enabled = true;
				frmAppOptionMain.TopLevel = false;
				frmAppOptionMain.Dock = DockStyle.Fill;
				this.splitContainer1.Panel2.Controls.Add(frmAppOptionMain);
				frmAppOptionMain.Show();
				return;
			}
			case "Node3":
				this.clearControl(this.splitContainer1, "objF1");
				return;
			case "Node4":
			{
				this.clearControl(this.splitContainer1, "objF1");
				frmAppOptionInput frmAppOptionInput = new frmAppOptionInput();
				frmAppOptionInput.grB1.Enabled = true;
				frmAppOptionInput.TopLevel = false;
				frmAppOptionInput.Dock = DockStyle.Fill;
				this.splitContainer1.Panel2.Controls.Add(frmAppOptionInput);
				frmAppOptionInput.Show();
				return;
			}
			case "Node5":
			{
				this.clearControl(this.splitContainer1, "objF1");
				frmAppOptionRetail frmAppOptionRetail = new frmAppOptionRetail();
				frmAppOptionRetail.grB1.Enabled = true;
				frmAppOptionRetail.TopLevel = false;
				frmAppOptionRetail.Dock = DockStyle.Fill;
				this.splitContainer1.Panel2.Controls.Add(frmAppOptionRetail);
				frmAppOptionRetail.Show();
				return;
			}
			case "Node6":
				this.clearControl(this.splitContainer1, "objF1");
				return;
			case "Node7":
			{
				this.clearControl(this.splitContainer1, "objF1");
				frmAppOptionFormatNumber frmAppOptionFormatNumber = new frmAppOptionFormatNumber();
				frmAppOptionFormatNumber.grB1.Enabled = true;
				frmAppOptionFormatNumber.TopLevel = false;
				frmAppOptionFormatNumber.Dock = DockStyle.Fill;
				this.splitContainer1.Panel2.Controls.Add(frmAppOptionFormatNumber);
				frmAppOptionFormatNumber.Show();
				return;
			}
			case "Node9":
			{
				this.clearControl(this.splitContainer1, "objF1");
				frmAppOptionBook frmAppOptionBook = new frmAppOptionBook();
				frmAppOptionBook.grB1.Enabled = true;
				frmAppOptionBook.TopLevel = false;
				frmAppOptionBook.Dock = DockStyle.Fill;
				this.splitContainer1.Panel2.Controls.Add(frmAppOptionBook);
				frmAppOptionBook.Show();
				return;
			}
			case "Node11":
			{
				this.clearControl(this.splitContainer1, "objF1");
				frmAppPrescription frmAppPrescription = new frmAppPrescription();
				frmAppPrescription.grB1.Enabled = true;
				frmAppPrescription.TopLevel = false;
				frmAppPrescription.Dock = DockStyle.Fill;
				this.splitContainer1.Panel2.Controls.Add(frmAppPrescription);
				frmAppPrescription.Show();
				return;
			}
			}
			this.clearControl(this.splitContainer1, "objF1");
		}
	}
}
